<!DOCTYPE html>
<html style="height: 100%">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>评分明细</title>
		<link rel="shortcut icon" href="../../images/my/favicon.ico" />
		<link rel="bookmark" href="../../images/my/favicon.ico" />
		<link rel="stylesheet" href="../../statics/layui/css/layui.css" />
		<link rel="stylesheet" href="../../css/admin/common.css" />
		<link rel="stylesheet" href="../../css/admin/admin_list.css" />
	</head>
	<script type="text/javascript" src="graphUtils/echarts.min.js">
	</script>

	<body style="height: 100%; margin: 0;overflow:hidden">
		<div class="layui-row" style="height: 100%;">

			<div class="layui-card-body" style="height: 100%;padding: 0;">

				<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
				<div id="container" style="height: 100%"></div>
			</div>
		</div>
		<script type="text/javascript" src="../../statics/layui/layui.js"></script>
		<script type="text/javascript" src="../../statics/lay/system/admin/public.js"></script>

		<script type="text/javascript" src="js/dataDisplay.js"></script>
		<script type="text/javascript" src="js/pieSrc.js"></script>
		<script>
			// 基于准备好的dom，初始化echarts实例
			var myChart = echarts.init(document.getElementById('container'));

			//题目
			var subjectData = new Array();

			//分数出现的次数
			var times_1 = new Array();
			var times_2 = new Array();
			var times_3 = new Array();
			var times_4 = new Array();

			layui.use(['form', 'rate', 'layer'], function() {

				var rate = layui.rate,
					form = layui.form,
					layer = layui.layer;
				var $ = layui.jquery;
				var isum = 1;
				var html;

				var tIdTwo = getUrlParam("tIdTwo"); // 获取上一页面传来的tid
				var cId = getUrlParam("cId"); // 获取上一页面传来的cid

				var infodata = {
					tIdTwo: tIdTwo,
					cId: cId
				};

				layer.load();

				setTimeout(function() {
					layer.closeAll('loading');
				}, 800);

				//initData();
				fandMyfen(infodata);

				// 返回评价列表
				$("#layui-layer2 span .layui-layer-close").on('click', function() {
					parent.layer.closeAll();
					//parent.location.reload(); //刷新父页面
				});

				var num_1, num_2, num_3, num_4;
				// 遍历解析Json
				function parseJson(JSONdata) {
					var num_11 = 0;
					var num_22 = 0;
					var num_33 = 0;
					var num_44 = 0;
					$.each(JSONdata.data, function(i, object) {
						num_11 += object.times_1;
						num_22 += object.times_2;
						num_33 += object.times_3;
						num_44 += object.times_4;
					});
					num_1 = num_11;
					num_2 = num_22;
					num_3 = num_33;
					num_4 = num_44;

				}

				// 指定图表的配置项和数据

				var piePatternImg = new Image();
				piePatternImg.src = piePatternSrc;
				var bgPatternImg = new Image();
				bgPatternImg.src = bgPatternSrc;

				var itemStyle = {
					normal: {
						opacity: 0.7,
						color: {
							image: piePatternImg,
							repeat: 'repeat'
						},
						borderWidth: 3,
						borderColor: '#235894'
					}
				};
				option = {
					backgroundColor: {
						image: bgPatternImg,
						repeat: 'repeat'
					},
					title: {
						text: '教师评教明细',
						textStyle: {
							color: '#235894'
						}
					},
					tooltip: {},
					series: [{
						name: 'pie',
						type: 'pie',
						selectedMode: 'single',
						selectedOffset: 30,
						clockwise: true,
						label: {
							normal: {
								textStyle: {
									fontSize: 18,
									color: '#235894'
								}
							}
						},
						labelLine: {
							normal: {
								lineStyle: {
									color: '#235894'
								}
							}
						},
						data: [{
								value: num_1,
								name: '差强人意'
							},
							{
								value: num_2,
								name: '一般'
							},
							{
								value: num_3,
								name: '满意'
							},
							{
								value: num_4,
								name: '非常满意'
							}
						],
						itemStyle: itemStyle
					}]
				};;
				if(option && typeof option === "object") {
					myChart.setOption(option, true);
				}

				// 请求 分数
				function fandMyfen(infodata) {
					$.ajax({
						type: "POST",
						contentType: "application/json; charset=utf-8",
						url: IP + "/api/teacher_eav/scoresDetailed/scoresTehDetailed",
						data: JSON.stringify(infodata),
						dataType: "json",
						async: false,
						success: function(data) {
							//							layer.closeAll('loading');
							parseJson(data);
							console.log("success");
						}
					});
				}
			});
		</script>

	</body>

</html>